cmake_minimum_required(VERSION 3.15)
project(ONNXRuntimeDemo)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(OpenMP REQUIRED)
find_package(Torch REQUIRED
            NO_MODULE
            PATHS /LLMsFavlor/app/libtorch
            NO_DEFAULT_PATH)
find_package(CUDAToolkit REQUIRED)
# 设置ONNX Runtime路径（可根据实际安装路径修改）
set(ONNXRUNTIME_ROOT "/LLMsFavlor/app/onnxruntime" CACHE PATH "ONNX Runtime installation directory")
include_directories(include)
add_subdirectory(extern/tokenizers-cpp)
add_subdirectory(extern/fmt-11.2.0)
# 包含ONNX Runtime头文件
include_directories(${ONNXRUNTIME_ROOT}/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)

# 链接库目录
link_directories(${ONNXRUNTIME_ROOT}/lib)

# 添加可执行文件
 add_executable(onnx_demo src/main.cpp)
 # 链接库
 target_link_libraries(onnx_demo
     PRIVATE
     onnxruntime
     tokenizers_cpp
     fmt
     "${TORCH_LIBRARIES}"
     OpenMP::OpenMP_CXX
 )


add_executable(cpptorch src/cpptorch.cpp)
# 链接库
target_link_libraries(cpptorch 
    PRIVATE
    tokenizers_cpp
    fmt
    "${TORCH_LIBRARIES}"
    OpenMP::OpenMP_CXX
    CUDA::cudart 
)